package cn.dgut.training.entity.vo;

import cn.dgut.training.dto.BaseDTO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
public class GroupJoinVO<T>{

    @ApiModelProperty(value = "参与表的ID")
    private Long id;

    @ApiModelProperty(value = "用户id")
    private Long userId;

    @ApiModelProperty(value = "活动id")
    private Long activityId;

    @ApiModelProperty(value = "订单id")
    private Long orderId;

    /**
     * 总记录数
     */
    private Integer total;

    /**
     * 总页数
     */
    private Integer pages;
    /**
     * 每页条数
     */
    private Integer size;
    /**
     * 当前页
     */
    private Integer current;

    /**
     * 返回集合
     */
    List<T> list;

    public GroupJoinVO(IPage page) {

        this.total = ((Long)page.getTotal()).intValue();
        this.pages = ((Long)page.getPages()).intValue();
        this.size = ((Long)page.getSize()).intValue();
        this.current = ((Long)page.getCurrent()).intValue();
        this.list = page.getRecords();
    }
}